package modelo;
// Generated 26/04/2014 23:46:36 by Hibernate Tools 3.6.0

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Reserva generated by hbm2java
 */
@Entity
@Table(name = "reserva", catalog = "sistemagestao"
)
public class Reserva implements java.io.Serializable {

    private Integer codReserva;
    private Recurso recurso;
    private Usuario usuario;
    private Date dataReserva;
    private Date horaInicio;
    private Date horaFim;

    public Reserva() {
        this.codReserva = 0;
        this.recurso = new Recurso();
        this.usuario = new Usuario();
    }

    public Reserva(Recurso recurso, Usuario usuario, Date dataReserva, Date horaInicio, Date horaFim) {
        this.recurso = recurso;
        this.usuario = usuario;
        this.dataReserva = dataReserva;
        this.horaInicio = horaInicio;
        this.horaFim = horaFim;
    }

    public Reserva(int codReserva, Recurso recurso, Usuario usuario, Date dataReserva, Date horaInicio, Date horaFim) {
        this.codReserva = codReserva;
        this.recurso = recurso;
        this.usuario = usuario;
        this.dataReserva = dataReserva;
        this.horaInicio = horaInicio;
        this.horaFim = horaFim;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "cod_reserva", unique = true, nullable = false)
    public Integer getCodReserva() {
        return this.codReserva;
    }

    public void setCodReserva(Integer codReserva) {
        this.codReserva = codReserva;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "nome_recurso", nullable = false)
    public Recurso getRecurso() {
        return this.recurso;
    }

    public void setRecurso(Recurso recurso) {
        this.recurso = recurso;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "nome_usuario", nullable = false)
    public Usuario getUsuario() {
        return this.usuario;
    }

    public void setUsuario(Usuario usuario) {
        this.usuario = usuario;
    }

    @Temporal(TemporalType.DATE)
    @Column(name = "data_reserva", nullable = false, length = 10)
    public Date getDataReserva() {
        return this.dataReserva;
    }

    public void setDataReserva(Date dataReserva) {
        this.dataReserva = dataReserva;
    }

    @Temporal(TemporalType.TIME)
    @Column(name = "hora_inicio", nullable = false, length = 8)
    public Date getHoraInicio() {
        return this.horaInicio;
    }

    public void setHoraInicio(Date horaInicio) {
        this.horaInicio = horaInicio;
    }

    @Temporal(TemporalType.TIME)
    @Column(name = "hora_fim", nullable = false, length = 8)
    public Date getHoraFim() {
        return this.horaFim;
    }

    public void setHoraFim(Date horaFim) {
        this.horaFim = horaFim;
    }

}
